home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / ShareMailGiftware / AmigaTalk / system / Library.st < prev    next >
Text File  |  2002-10-27  |  2KB  |  86 lines

  1. " ------------------------------------------------------------------- "
  2. " Library Class is temporarily derived from Object.                   "
  3. ""
  4. " WARNING:  The following methods are NOT really necessary for your   "
  5. "           use: "
  6. ""
  7. "   addLibrary:                            "
  8. "   makeLibrary:struct:init:size:segments: "
  9. "   removeLibrary:                         "
  10. "   setFunctionIn:at:to:                   "
  11. "   sumLibrary:                            "
  12. " ------------------------------------------------------------------- "
  13.  
  14. Class Library :Object ! private libName !
  15. [
  16.    makeLibrary: funcInitObj struct: structInitObj init: libInitFuncObj 
  17.                               size: dataSize      segments: segList
  18.  
  19.       " Ordinary users should use openLibrary:version: or new: instead! "
  20.  
  21.       ^ <primitive 209 4 27 funcInitObj structInitObj libInitFuncObj dataSize segList>
  22. |
  23.    addLibrary: libraryObj
  24.       " Used after makeLibrary:struct:init:size:segments: method " 
  25.       <primitive 209 4 21 libraryObj>
  26. |
  27.    removeLibrary: libraryObj
  28.       " Only use this method if you used the addLibrary: method "
  29.       <primitive 209 4 22 libraryObj>
  30. |
  31.    setFunctionIn: libraryObj at: funcOffset to: newFuncPtrObj
  32.       " The returned value is the oldFuncPtrObj, which MUST BE 
  33.       * saved so that you can restore the libraryObj back to it's
  34.       * original state.  There is currently NO AmigaTalk method 
  35.       * that can create a funcPtrObj, so DO NOT USE THIS METHOD!
  36.       "
  37.       ^ <primitive 209 4 23 libraryObj funcOffset newFuncPtrObj>
  38. |
  39.    sumLibrary: libraryObj
  40.       <primitive 209 4 24 libraryObj>
  41. |
  42.    getLibraryObject
  43.      ^ private
  44. |
  45.    openLibrary: libraryName version: ver
  46.      private <- <primitive 190 1 libraryName ver>.
  47.  
  48.      libName <- libraryName.
  49.  
  50.      ^ self
  51. |
  52.    close
  53.      <primitive 190 0 private>.
  54.  
  55.      ^ nil
  56. |
  57.    getIDString
  58.      ^ libName
  59. |
  60.    getVersion
  61.      ^ <primitive 190 2 4 private>
  62. |
  63.    getNegSize
  64.      ^ <primitive 190 2 1 private>
  65. |
  66.    getPosSize
  67.      ^ <primitive 190 2 2 private>
  68. |
  69.    getFlags
  70.      ^ <primitive 190 2 3 private>
  71. |
  72.    getRevision
  73.      ^ <primitive 190 2 5 private>
  74. |
  75.    getCheckSum
  76.      ^ <primitive 190 2 6 private>
  77. |
  78.    getOpenCount
  79.      ^ <primitive 190 2 7 private>
  80. |
  81.    new: libname
  82.      self openLibrary: libname version: 0.
  83.  
  84.      ^ self
  85.